package com.kapcb.async.wrapper;

/**
 * <a>Title: DependWrapper </a>
 * <a>Author: Kapcb <a>
 * <a>Description: 对依赖 wrapper 的包装 <a>
 *
 * @author Kapcb
 * @version 1.0
 * @date 2024/5/10 20:33
 * @since 1.0
 */
public class DependencyWrapper {

    private WorkerWrapper<?, ?> dependWrapper;

    /**
     * 是否该依赖必须完成后才能执行自己
     * 因为存在一个任务，依赖于多个任务，是让这多个任务全部完成后才执行自己，还是某几个执行完毕就可以执行自己
     * 如果
     * 1
     * --------3
     * 2
     * 或者
     * 1--------3
     * 2--------3
     * 这两种就不一样，上面的就是必须 1、2 都完毕，才能 3
     * 下面的就是 1 完毕就可以 3
     */
    private boolean must;

    public DependencyWrapper() {
    }

    public DependencyWrapper(WorkerWrapper<?, ?> dependWrapper, boolean must) {
        this.dependWrapper = dependWrapper;
        this.must = must;
    }

    public WorkerWrapper<?, ?> getDependWrapper() {
        return dependWrapper;
    }

    public void setDependWrapper(WorkerWrapper<?, ?> dependWrapper) {
        this.dependWrapper = dependWrapper;
    }

    public boolean isMust() {
        return must;
    }

    public void setMust(boolean must) {
        this.must = must;
    }

    @Override
    public String toString() {
        return "DependencyWrapper{" +
                "dependWrapper=" + dependWrapper +
                ", must=" + must +
                '}';
    }
}
